package org.dromara.xxmj.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.demo.utils.ValidateUtil;
import org.dromara.xxmj.domain.dto.GetExamDTO;
import org.dromara.xxmj.domain.vo.*;
import org.dromara.xxmj.service.ExamInfomationService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 考试咨询Api
 *
 * @author Vincent
 */
@Slf4j
@Tag(name = "考试咨询Api")
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/exam/information")
public class ExamInfomationController extends BaseController {

    @Resource
    private ExamInfomationService examInfomationService;

    /**
     * 省份列表
     */
    @Operation(summary = "省份列表")
    @GetMapping("/geographyList")
    public R<List<GeographyVO>> getProvinceList() {
        return R.ok(examInfomationService.getProvinceList());
    }


    /**
     * 资讯列表
     */
    @Operation(summary = "资讯列表")
    @PostMapping("/examList")
    public R<List<ExamInfoVO>> getExamList(@RequestBody @Valid GetExamDTO getExamDTO) {
        return R.ok(examInfomationService.getExamList(getExamDTO));
    }

    /**
     * 模拟卷列表
     *
     * @Author 王晨沣
     * @Date 2025-06-04 10:54:05
     */
    @Operation(summary = "模拟卷列表")
    @PostMapping("/simulationList/{courseId}")
    public R<List<GetSimulationVO>> simulationList(@Parameter(description = "课程ID") @PathVariable Integer courseId) {
        return R.ok(examInfomationService.simulationList(courseId));
    }

    /**
     * 考试统计
     * @Author 王晨沣
     * @Date 2025-06-05 15:00:59
     */
    @Operation(summary = "考试统计")
    @PostMapping("/examStat")
    public R<ExamStatVO> examStat() {
        return R.ok(examInfomationService.examStat());
    }


    /**
     * 最近考试
     * @Author 王晨沣
     * @Date 2025-06-05 15:21:18
     */
    @Operation(summary = "最近考试")
    @PostMapping("/recentExam")
    public R<List<RecentExamVO>> recentExam() {
        return R.ok(examInfomationService.recentExam());
    }





//    /**
//     * 获取订单详情
//     */
//    @Operation(summary = "获取订单详情")
//    @GetMapping("/detail/{id}")
//    public R<CourseOrder> getOrderDetail(@Parameter(description = "订单ID") @PathVariable Long id) {
//        return R.ok(orderService.getOrderById(id));
//    }
//
//    /**
//     * 支付订单
//     */
//    @Operation(summary = "支付订单")
//    @PostMapping("/pay/{id}")
//    public R<Boolean> payOrder(
//        @Parameter(description = "订单ID") @PathVariable Long id,
//        @Parameter(description = "支付方式") @RequestParam(required = false, defaultValue = "1") String payType
//    ) {
//        return R.ok(orderService.payOrder(id, payType));
//    }
//
//    /**
//     * 取消订单
//     */
//    @Operation(summary = "取消订单")
//    @PostMapping("/cancel/{id}")
//    public R<Boolean> cancelOrder(@Parameter(description = "订单ID") @PathVariable Long id) {
//        return R.ok(orderService.cancelOrder(id));
//    }
//
//    /**
//     * 订单列表
//     * @Author 王晨沣 2307105054
//     * @Date 2025-05-26 09:35:06
//     */
//    @Operation(summary = "订单列表")
//    @GetMapping("/orderList")
//    public R<List<CourseOrderVo>> listOrders(PageQuery pageQuery) {
//        return R.ok(orderService.listOrders(pageQuery));
//    }




}
